<?php
namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Logics\LogXxhfLogic;
use App\Logics\LogNotifyAlipayLogic;
use App\Logics\LogLogic;




use Illuminate\Support\Facades\Storage;
class LogController extends BaseController{

    private function getInstance(){
        static $ob=null;
        if(is_null($ob)){
            $ob= new LogLogic();
        }
        return $ob;
    }
    public function h5paylog(){
        $page = (int)request("page", 1);
        $per_page = (int)request("per_page", 20);
        $order_stages_id=trim(request('order_stages_id'));

        $para=[
            'page'=>$page,
            'per_page'=>$per_page,
            'order_stages_id'=>$order_stages_id
        ];
        $ob=$this->getInstance();
        $arr=$ob->h5paylog($para);

        if($arr && is_string($arr)) die(json_error($arr));
        $content= view("admin.log.h5paylog",$arr) ;
        $data=[
            'content'=>$content,
            'header'=>'h5支付日志',
        ];
        return  $this->baseList($data);
    }


    //信用借还日志
    public function xyjhlog(){
        $page = (int)request("page", 1);
        $per_page = (int)request("per_page", 20);
        $out_order_no=trim(request('out_order_no'));

        $para=[
            'page'=>$page,
            'per_page'=>$per_page,
            'out_order_no'=>$out_order_no
        ];
        $ob=$this->getInstance();
        $arr=$ob->xyjhlog($para);
        if($arr && is_string($arr)) die(json_error($arr));

        $content= view("admin.log.xyjhlog",$arr) ;
        $data=[
            'content'=>$content,
            'header'=>'h5信用借还',
        ];
        return  $this->baseList($data);
    }

    //小程序日志
    public function xcxlog(){
        $page = (int)request("page", 1);
        $per_page = (int)request("per_page", 20);
        $out_order_no=trim(request('out_order_no'));

        $para=[
            'page'=>$page,
            'per_page'=>$per_page,
            'out_order_no'=>$out_order_no
        ];
        $ob=$this->getInstance();
        $arr=$ob->xcxlog($para);
        if($arr && is_string($arr)) die(json_error($arr));

        $content= view("admin.log.xcxlog",$arr) ;
        $data=[
            'content'=>$content,
            'header'=>'小程序日志',
        ];
        return  $this->baseList($data);
    }

    //定时器日志
    public function autolog(){
        $page = (int)request("page", 1);
        $per_page = (int)request("per_page", 20);
        $out_order_no=trim(request('out_order_no'));

        $para=[
            'page'=>$page,
            'per_page'=>$per_page,
            'out_order_no'=>$out_order_no
        ];
        $ob=$this->getInstance();
        $arr=$ob->autolog($para);
        if($arr && is_string($arr)) die(json_error($arr));


        $content= view("admin.log.autolog",$arr) ;
        $data=[
            'content'=>$content,
            'header'=>'定时器日志',
        ];
        return  $this->baseList($data);
    }

    //先享后付日志
    public function xxhflog(){
        $page = (int)request("page", 1);
        $per_page = (int)request("per_page", 20);
        $order_id =trim(request('order_id'));

        $para=[
            'page'=>$page,
            'per_page'=>$per_page,
            'order_id'=>$order_id
        ];
        $ob=$this->getInstance();
        $arr=$ob->xxhflog($para);
        if($arr && is_string($arr)) die(json_error($arr));

        $content= view("admin.log.xxhflog",$arr) ;
        $data=[
            'content'=>$content,
            'header'=>'先享后付日志',
        ];
        return  $this->baseList($data);
    }

}